home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / c / AMesaRTL.lha / Mesa-2.6 / amiga / src-glut / glutInit.c < prev    next >
C/C++ Source or Header  |  1998-09-19  |  3KB  |  140 lines

  1. /*
  2.  * Amiga GLUT graphics library toolkit
  3.  * Version:  2.0
  4.  * Copyright (C) 1998 Jarno van der Linden
  5.  *
  6.  * This library is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU Library General Public
  8.  * License as published by the Free Software Foundation; either
  9.  * version 2 of the License, or (at your option) any later version.
  10.  *
  11.  * This library is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.  * Library General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU Library General Public
  17.  * License along with this library; if not, write to the Free
  18.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  */
  20.  
  21.  
  22. /*
  23.  * glutInit.c
  24.  *
  25.  * Version 1.0  27 Jun 1998
  26.  * by Jarno van der Linden
  27.  * jarno@kcbbs.gen.nz
  28.  *
  29.  * Version 1.1  02 Aug 1998
  30.  * by Jarno van der Linden
  31.  * jarno@kcbbs.gen.nz
  32.  *
  33.  * - Added quantizer plugin arguments
  34.  *
  35.  * Version 2.0  19 Sep 1998
  36.  * by Jarno van der Linden
  37.  * jarno@kcbbs.gen.nz
  38.  *
  39.  * - Changed to runtime library format
  40.  * - Changed quantizer to output handler
  41.  * - Added -nohandlerwindow argument
  42.  *
  43.  */
  44.  
  45. #include <proto/intuition.h>
  46.  
  47. #include <string.h>
  48.  
  49. #include "glutstuff.h"
  50.  
  51.  
  52. int Limit(int v, int minv,int maxv)
  53. {
  54.     if(v < minv)
  55.         return(minv);
  56.     if(v > maxv)
  57.         return(maxv);
  58.  
  59.     return(v);
  60. }
  61.  
  62.  
  63. void RemoveArg( int n, int *argc, char **argv)
  64. {
  65.     int t;
  66.     char *p;
  67.  
  68.     p = argv[n];
  69.  
  70.     for(t=n; t<((*argc)-1); t++)
  71.     {
  72.         argv[t] = argv[t+1];
  73.     }
  74.     argv[(*argc)-1] = p;
  75.     (*argc)--;
  76. }
  77.  
  78.  
  79. __asm __saveds void glutInit( register __a0 int *argcp, register __a1 char **argv )
  80. {
  81.     int t;
  82.  
  83.     CurrentTime(&(glutstuff.basetime_secs),&(glutstuff.basetime_micros));
  84.     glutstuff.havebasetime = TRUE;
  85.  
  86.     for(t=(*argcp)-1; t>=1; t--)
  87.     {
  88.         if((!stricmp(argv[t],"-numcolours")) || (!stricmp(argv[t],"-numcolors")))
  89.         {
  90.             if(t < ((*argcp)-1))
  91.             {
  92.                 glutstuff.numcolours = Limit(atoi(argv[t+1]),2,256);
  93.                 RemoveArg(t,argcp,argv);
  94.                 RemoveArg(t,argcp,argv);
  95.             }
  96.         }
  97.         else if((!stricmp(argv[t],"-colourbase")) || (!stricmp(argv[t],"-colorbase")))
  98.         {
  99.             if(t < ((*argcp)-1))
  100.             {
  101.                 glutstuff.colourbase = Limit(atoi(argv[t+1]),0,254);
  102.                 RemoveArg(t,argcp,argv);
  103.                 RemoveArg(t,argcp,argv);
  104.             }
  105.         }
  106.         else if(!stricmp(argv[t],"-pubscreen"))
  107.         {
  108.             if(t < ((*argcp)-1))
  109.             {
  110.                 glutstuff.pubscreenname = argv[t+1];
  111.                 RemoveArg(t,argcp,argv);
  112.                 RemoveArg(t,argcp,argv);
  113.             }
  114.         }
  115.         else if(!stricmp(argv[t],"-outputhandler"))
  116.         {
  117.             if(t < ((*argcp)-1))
  118.             {
  119.                 glutstuff.oh = argv[t+1];
  120.                 RemoveArg(t,argcp,argv);
  121.                 RemoveArg(t,argcp,argv);
  122.             }
  123.         }
  124.         else if(!stricmp(argv[t],"-outputhandlerversion"))
  125.         {
  126.             if(t < ((*argcp)-1))
  127.             {
  128.                 glutstuff.ohversion = atol(argv[t+1]);
  129.                 RemoveArg(t,argcp,argv);
  130.                 RemoveArg(t,argcp,argv);
  131.             }
  132.         }
  133.         else if(!stricmp(argv[t],"-nohandlerwindow"))
  134.         {
  135.             glutstuff.handlerwindow = FALSE;
  136.             RemoveArg(t,argcp,argv);
  137.         }
  138.     }
  139. }
  140.